<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.encuestame</groupId>
        <artifactId>web-app</artifactId>
        <version>1.5.0</version>
    </parent>
    <version>1.5.0</version>
    <artifactId>selenium-test</artifactId>
    <packaging>war</packaging>
    <name>Selenium Test</name>
    <profiles>
        <profile>
            <id>external</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <testFailureIgnore>${surefire.failures.ignore}</testFailureIgnore>
                            <argLine>-Xmx1024m</argLine>
                            <skipTests>false</skipTests>
                        </configuration>
                        <version>${surefire.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>${surefire.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>functional-test</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>${maven.war.plugin}</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.12</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>${maven-antrun-plugin}</version>
                        <executions>
                            <execution>
                                <id>home-enme</id>
                                <phase>
                                    compile
                                </phase>
                                <configuration>
                                    <target>
                                        <mkdir dir="${project.build.directory}/encuestame-home" />
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>${jetty-plugin-version}</version>
                        <executions>
                            <execution>
                            <id>start-jetty</id>
                                <phase>pre-integration-test</phase>
                            <goals>
                                <goal>run-war</goal>
                            </goals>
                            <configuration>
                                 <scanIntervalSeconds>0</scanIntervalSeconds>
                                 <daemon>true</daemon>
                            </configuration>
                            </execution>
                        <execution>
                            <id>stop-jetty</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <stopKey>selenium</stopKey>
                            <stopPort>9999</stopPort>
                            <connectors>
                                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                                    <port>${jetty.default.port}</port>
                                </connector>
                            </connectors>
                            <webAppConfig>
                                <contextPath>/encuestame</contextPath>
                                <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
                            </webAppConfig>
                            <scanIntervalSeconds>0</scanIntervalSeconds>
                            <daemon>true</daemon>
                        </configuration>
                    </plugin>                    
                </plugins>
                <resources>
                    <resource>
                        <directory>src/main/resources/</directory>
                        <includes>
                            <include>*.*</include>
                        </includes>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </build>
        </profile>
    </profiles>
    <dependencies>     
        <dependency>
            <groupId>org.encuestame</groupId>
            <artifactId>enme-config</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>org.encuestame</groupId>
            <artifactId>enme-views</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
        </dependency>
        <!-- Will bring in once we configure a Chrome option -->
       <!--dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>${selenium.version}</version>
        </dependency-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
            <version>4.3.2</version>    
        </dependency>
    </dependencies>
</project>